package main;

import java.io.*;
import java.util.*;

import db.*;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet("/Controller")
public class Controller extends HttpServlet
{
	private static final long serialVersionUID = 1L;


	protected void doGet(HttpServletRequest req,
			HttpServletResponse res) throws ServletException, IOException
	{
		doGetPost(req, res);
	}

	protected void doPost(HttpServletRequest req,
			HttpServletResponse res) throws ServletException, IOException
	{
		doGetPost(req, res);
	}

	protected void doGetPost(HttpServletRequest req,
			HttpServletResponse res) throws ServletException, IOException
	{
		try
		{
			res.setContentType("text/html");
			PrintWriter out = res.getWriter();
			
			ArrayList<String> arr_Users = DB_Access.getUsernames();
			
			String s_Html = "";
			
			for (int i = 0; i < arr_Users.size(); i++)
			{
				s_Html += "<p>" + arr_Users.get(i) + "</p>";
			}
			
			out.print(s_Html);
		}
		catch (Exception e)
		{
			System.out.println(e);
		}
	}

}
